#include <functional>
#include<windows.h>
#include "Rect2.h"
#include <string>
#include <gl/glut.h>

using namespace std;

class UI
{
public:
	UI(){}

public:
	class Button
	{
	public:
		Rect2 rect;
		string text;
		std::function<void(int,int)> runFunction;

		Button(){}

		//button constructors
		Button(Rect2 rect, string text)
		{
			Button::rect = rect;
			Button::text = text;
		}


		bool handleClick(int x, int y)
		{
			if (isInside(x, y))
			{
				runFunction(7,77);
				return true;
			}
			else
			{
				return false;
			}

		}

	private:
		bool isInside(int x, int y)
		{
			cout << "Mouse X: " << x << " Mouse Y: " << y << endl;
			cout << " Button bottom: " << rect.bottom << " Button top: " << rect.top << endl;
			cout << " Button left: " << rect.left << " Button right: " << rect.right << endl;

			if(x > rect.bottom && x < rect.top && y > rect.left && y < rect.right )
			{
				return true;
			}
			else
			{
				return false;
			}
		}
	};
};